<template>
	<view class="page">
		<view class="body">
			<view class="body_title justify-content-sp">
				<view class="body_title_">
					提现账户
				</view>
				<view class="body_title_img" @click="chooseWay">
					<image src="../../static/purse/zhanghuliebiao.png" mode="" class="image"></image>
				</view>
			</view>
			<view class="body_cont" v-if="payoutsWay == 2">
				<view class="body_cont_text">
					银行账户
				</view>
				<view class="body_cont_text">
					工商银行
				</view>
				<view class="body_cont_text">
					张三(1234 **** **** 4567)
				</view>
			</view>
			<view class="body_cont" v-if="payoutsWay == 1">
				<view class="body_cont_text">
					支付宝账户
				</view>
				<view class="body_cont_text">
					张三 (12345678912)
				</view>
			</view>
		</view>
		<view class="body">
			<view class="body_title" style="border: none;">
				<view class="body_title_">
					提现金额
				</view>
				<view class="body_title_money">
					<view class="body_title_money_left">
						￥
					</view>
					<view class="body_title_money_right">
						<input type="number" class="uni-input" placeholder="请输入金额" v-model="money" />
					</view>
				</view>
				<view class="body_title_se">
					当前可用余额8545421.23元，<text style="color: #ff6433;">全部提现</text>
				</view>
			</view>
		</view>
		<view class="btn" style="margin-top: 40px;" @click="pay_open">
			确定
		</view>
		<!-- 选择提现账户 -->
		<uni-popup ref="popup_way" type="bottom" border-radius="10px 10px 0 0">
			<view class="popup">
				<view class="">
					<uni-icons type="close" size="30" @click="popup_close"></uni-icons>
				</view>
				<view class="popup_title">
					选择提现账户
				</view>
				<view class="pay_way_list">
					<uni-data-checkbox v-model="value" :localdata="pay_way_List" @change="change"></uni-data-checkbox>
				</view>
				<view class="btn" style="margin-top: 60rpx;" @click="btn">
					确定
				</view>
			</view>
		</uni-popup>
		<!-- 公告弹窗 -->
		<uni-popup ref="announcement" type="bottom" border-radius="10px 10px 0 0">
			<view class="popups">
				<view class="popups_title">
					五一节假日公告
				</view>
				<view class="popups_text">
					尊敬的商家您好
				</view>
				<view class="popups_text">
					关于五一节假日等商家提现到账安排如下：五月一日-五月五日为财务人员放假期间！
				</view>
				<view class="btn btn_css" @click="announcement_close">
					关闭
				</view>
			</view>
		</uni-popup>
		<!-- 支付密码弹窗 -->
		<uni-popup ref="pay_popup" type="bottom" border-radius="10px 10px 0 0">
			<view class="popups">
				<uni-icons type="close" size="30" @click="pay_close(0)"></uni-icons>
				<view class="popups_title" style="margin-top: -30px;color: black;font-size: 25px;">
					请输入支付密码
				</view>
				<view class="popus_body">
					提现
				</view>
				<view class="popus_money justify-content-center">
					<text class="popus_money_right">
						<text style="font-size: 18px;">￥</text>{{money}}
					</text>
				</view>
				<view class="popus_money_fir justify-content-sp">
					<view class="popus_money_fir_left">
						手续费
					</view>
					<view class="popus_money_fir_right">
						￥4.5
					</view>
				</view>
				<view class="popus_money_se">
					由银行机构收取相应手续费
				</view>
				<view class="popus_money_thr">
					<input type="password" placeholder="请输入密码" class="password" :maxlength="6">
				</view>
				<view class="btn btn_css" @click="pay_close(1)">
					确定
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value: 0, //提现方式
				money: '', //提现金额
				payoutsWay: 0, //提现方式
				pay_way_List: [{
						id: 0,
						text: "微信",
						icon: '/static/purse/wx.png',
						value: 0
					},
					{
						id: 1,
						text: "支付宝",
						icon: '/static/purse/zfb.png',
						value: 1
					},
					{
						id: 2,
						text: "工商银行",
						icon: '/static/purse/yhk.png',
						value: 2,
						number: "1234 **** **** 1234"
					}

				],
			}
		},
		onLoad() {

		},
		methods: {
			// 选择提现账户
			chooseWay() {
				this.$refs.popup_way.open('bottom')
			},
			//关闭提现账户
			popup_close() {
				this.$refs.popup_way.close('bottom')
			},
			// 选择提现账户
			btn() {
				if (this.value != 0) {
					this.payoutsWay = this.value
				}
				this.$refs.popup_way.close('bottom')
			},
			// 提现方式
			change(e) {
				this.value = e.detail.value;
			},
			// 开启公告弹窗
			announcement() {
				this.$refs.announcement.open('center')
			},
			// 关闭公告弹窗
			announcement_close() {
				this.$refs.announcement.close('center')
			},
			// 支付弹窗
			pay_open() {
				this.$refs.pay_popup.open('center')
			},
			// 关闭支付弹窗
			pay_close(e) {
				if (e == 0) {
					this.$refs.pay_popup.close('center')
				} else {
					this.$refs.pay_popup.close('center')
					uni.navigateTo({
						url: '/pages/payouts/await'
					})
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		.body {
			.body_title {
				border-bottom: 1px solid #b2b2b2;
				padding: 10px 0;

				.body_title_ {
					font-weight: 600;
				}

				.body_title_money {
					border-bottom: 1px solid #b2b2b2;
					padding: 20rpx 0;
					display: flex;

					.body_title_money_left {
						font-size: 20px;
					}

					.body_title_money_right {
						padding: 5rpx;
					}
				}

				.body_title_se {
					padding: 30rpx 0 0 0;
				}

				.body_title_img {
					width: 16px;
					height: 16px;

					.image {
						width: 100%;
						height: 100%;
					}
				}
			}

			.body_cont {
				padding: 30rpx 0 0 0;

				.body_cont_text {
					line-height: 28px;
					font-size: 17px;
				}
			}
		}

		.popup {
			background-color: white;
			height: 300px;
			border-radius: 30rpx 30rpx 0 0;
			padding: 30rpx;

			.popup_title {
				text-align: center;
				font-size: 20px;
				font-weight: 550;
				margin-top: -20rpx;
			}

			.pay_way_list {
				padding: 30rpx 0;
				overflow: auto;
				height: 120px;
			}
		}

		.popups {
			background-color: white;
			width: 640rpx;
			padding: 30rpx;
			border-radius: 30rpx;

			.popups_title {
				text-align: center;
				font-size: 28px;
				color: #ff4509;
				padding: 30rpx;
			}

			.popus_body {
				margin-top: 20rpx;
				text-align: center;
			}

			.popus_money {
				align-items: flex-end;
				padding-bottom: 20rpx;
				border-bottom: 1px solid #b2b2b2;

				.popus_money_right {
					font-size: 30px;
				}
			}

			.popus_money_fir {
				padding: 30rpx 0;
				font-size: 18px;

				.popus_money_fir_left {
					font-weight: 550;
				}

				.popus_money_fir_right {
					color: red;
				}
			}

			.popus_money_se {
				color: #b2b2b2;
			}

			.popus_money_thr {
				padding: 30rpx;

				.password {
					text-align: center;
					font-size: 40px;
					border: 1px solid #b2b2b2;
					padding: 10rpx;
					border-radius: 15rpx;
				}
			}

			.btn_css {
				padding: 30rpx;
				border-radius: 50rpx;
			}

			.popups_text {
				line-height: 30px;
				font-size: 18px;
			}

			.btn_css {
				margin-top: 30px;
			}
		}
	}
</style>